home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / c_tutor.arc / SOURCE.ARC / NESTED.C < prev    next >
C/C++ Source or Header  |  1990-08-08  |  877b  |  40 lines

  1.                                      /* Chapter 11 - Program 4 */
  2. main()
  3. {
  4. struct person {
  5.    char name[25];
  6.    int age;
  7.    char status;        /* M = married, S = single */
  8. } ;
  9.  
  10. struct alldat {
  11.    int grade;
  12.    struct person descrip;
  13.    char lunch[25];
  14. } student[53];
  15.  
  16. struct alldat teacher,sub;
  17.  
  18. teacher.grade = 94;
  19. teacher.descrip.age = 34;
  20. teacher.descrip.status = 'M';
  21. strcpy(teacher.descrip.name,"Mary Smith");
  22. strcpy(teacher.lunch,"Baloney sandwich");
  23.  
  24. sub.descrip.age = 87;
  25. sub.descrip.status = 'M';
  26. strcpy(sub.descrip.name,"Old Lady Brown");
  27. sub.grade = 73;
  28. strcpy(sub.lunch,"Yogurt and toast");
  29.  
  30. student[1].descrip.age = 15;
  31. student[1].descrip.status = 'S';
  32. strcpy(student[1].descrip.name,"Billy Boston");
  33. strcpy(student[1].lunch,"Peanut Butter");
  34. student[1].grade = 77;
  35.  
  36. student[7].descrip.age = 14;
  37. student[12].grade = 87;
  38.  
  39. }
  40.